package com.lijj.activiti.demo.test;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;

public class ExecutionListenerInvocation {
	@org.junit.Test
	public void test() {
		ProcessEngine engine = ProcessEngineConfiguration
				.createProcessEngineConfigurationFromResource(
						"temp/activiti.cfg.xml").buildProcessEngine();
		RepositoryService repositoryService = engine.getRepositoryService();
		RuntimeService runtimeService = engine.getRuntimeService();
		TaskService taskService=engine.getTaskService();
		repositoryService.createDeployment()
				.addClasspathResource("bpmn/ExecutionListenerInvocation.bpmn")
				.deploy();
		runtimeService.startProcessInstanceByKey("executionListenerInvocation");
		Task task = taskService.createTaskQuery()
				.processDefinitionKey("executionListenerInvocation")
				.singleResult();
		taskService.complete(task.getId());
		
	}
}
